Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 3 - Page Formatting and Dialog Box Customization / Using Format Objects and Collection Items to Format Pages


Obtaining a Paper-Type Object Associated With a Format

QuickDraw GX allows a user to specify a paper-type name for each page of a document. Pages with different imageable areas require different format objects. Imageable areas differ both because of physical characteristics (paper size and page size) and because of rendering characteristics (such as scaling and orientation).

Pages require different paper-type objects only when the physical characteristics differ. A change in the paper-type object requires a change in the format object. The job object in Figure 3-18 references three format objects and three paper-type objects. This allows a user to print the address page on an envelope, a letter that contains graphics on an 8.5-by-11 inch sheet of paper in portrait orientation, and a page of graphics on a sheet of paper in landscape orientation.

Figure 3-18 A three-page document and its corresponding job object, format objects, and paper-type objects

You can use the GXGetFormatPaperType function to obtain a format object's associated paper-type object. For detailed information on working with paper-type objects, see the chapter "Advanced Printing Features" in this book.

Listing 3-16 shows how to obtain the paper-type object that a format object references. The MyGetPaperTypeName function in the listing returns the name stored in the paper-type object.

Listing 3-16 Obtaining the paper-type object associated with a format object

OSErr MyGetPaperTypeName(MyDocumentPtr myDocument, Str255 
                                                   paperTypeName)
{
   gxPaperType    thePaperType;
   long           curPage;
   gxFormat       pgFormat;

   /* 
      Get the current page's format. A nil reference specifies
      using the job's format object.
   */
   curPage = myDocument->curPage;
   pgFormat = myDocument->pageFormat[curPage -1];
   if (pgFormat == nil)
      pgFormat = GXGetJobFormat(myDocument->documentJob, 1);

   /* Get the format's object paper-type object and name. */
   thePaperType = GXGetFormatPaperType(pgFormat);
   GXGetPaperTypeName(thePaperType, paperTypeName);
   return GXGetJobError(myDocument->documentJob);
}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help